<template>
  <section class="brand-timeline">
    <h2 class="section-title">发展历程</h2>

    <div class="timeline-content">
      <div class="timeline-line"></div>

      <div
        v-for="item in milestones"
        :key="item.year"
        class="timeline-point"
      >
        <div class="circle" />
        <div class="year-label">{{ item.year }}</div>

        <!-- 节点对应详情卡片 -->
        <div class="detail-card">
          <div class="arrow" />
          <div class="card-inner">
            <h4 class="event">{{ item.event }}</h4>
            <p class="desc">{{ item.description }}</p>
          </div>
        </div>
      </div>
    </div>
  </section>
</template>

<script setup>
import { ref } from 'vue'

const milestones = ref([
  { year: '2010', event: '品牌创立',    description: '第一家 Volcanic 咖啡馆在夏威夷开业，开启豆香传奇。' },
  { year: '2015', event: '国际合作',    description: '与意大利烘焙大师合作，推出深度烘焙限量版。' },
  { year: '2018', event: '产品扩张',    description: '从浓缩拓展至冷萃、摩卡、挂耳等全线精品。' },
  { year: '2021', event: '全球布局',    description: '门店遍布欧洲、亚洲 12 座城市，融入当地咖啡文化。' },
  { year: '2024', event: '可持续先锋',  description: '全门店咖啡渣零排放，引领行业环保新风尚。' }
])
</script>

<style scoped>
.brand-timeline {
  max-width: 1000px;
  width: 100%;
  padding: 80px 20px 180px;
  text-align: center;
  margin: 0 auto;
  overflow: hidden;
}

/* 标题样式统一 */
.section-title {
  font-size: 28px;
  font-weight: 600;
  color: #4a2e18;
  letter-spacing: 1px;
  margin-bottom: 60px;
  position: relative;
  display: inline-block;
}
.section-title::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(to right, #c19a6b, #ffb46a);
  border-radius: 2px;
  opacity: 0.8;
}

/* 时间线结构 */
.timeline-content {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1000px;
  margin: 0 auto;
}
.timeline-line {
  position: absolute;
  top: 50%;
  left: 5%;
  right: 5%;
  height: 2px;
  background: #ddd0c0;
  transform: translateY(-50%);
  z-index: 1;
}
.timeline-point {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.circle {
  width: 14px;
  height: 14px;
  background: #4a2e18;
  border: 2px solid #fff3e0;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(74,46,24,0.3);
  z-index: 2;
}
.year-label {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #4a2e18;
  z-index: 2;
}

/* 浮出的详情卡片 */
.detail-card {
  position: absolute;
  top: calc(50% + 40px);
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  background: rgba(245, 228, 213, 0.9); /* 奶咖色质感 */
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  z-index: 3;
}
.timeline-point:hover .detail-card {
  opacity: 1;
  visibility: visible;
}
.arrow {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid rgba(245, 228, 213, 0.9);
}
.card-inner {
  text-align: center;
}
.event {
  font-size: 16px;
  font-weight: 600;
  color: #4a2e18;
  margin-bottom: 6px;
}
.desc {
  font-size: 14px;
  color: #5a4631;
  line-height: 1.6;
}
</style>
